package com.pharmacy.mapper;


import com.github.pagehelper.Page;
import com.pharmacy.dto.CategoriesPageSelectDto;
import com.pharmacy.entity.ExpiredDrugs;
import com.pharmacy.entity.Medicines;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;


@Mapper
public interface ExpiredDrugsMapper {

    /**
     * 添加过期药物
     * @param medicines
     */

    @Insert("insert into expiredDrugs(name, barcode, price, stock, description, image, isPrescription, expiration_date, categories_id) " +
            "values (#{name},#{barcode},#{price},#{stock},#{description},#{image},#{isPrescription},#{expirationDate},#{categoriesId})")
    void addExpiredDrugs(Medicines medicines);


    /**
     * 分页查询过期药物
     * @param categoriesPageSelectDto
     * @return
     */
    Page<ExpiredDrugs> pageSelect(CategoriesPageSelectDto categoriesPageSelectDto);


    /**
     * 删除过期药物
     * @param id
     */
    @Delete("delete from expiredDrugs where id = #{id}")
    void deleteExpiredDrugs(Integer id);
}
